<?php

Class Dokter extends CI_Controller
{
	function __construct()
	{
		parent::__construct();
		//load model
		$this->load->model('data/mdokter');		
	}

	function index()
	{
		$this->tampil();
	}

	function tampil()
	{
		$data['tampil'] = $this->mdokter->daftar_dokter();
		$this->load->view('data/vdokter',$data);
	}

	function new_dokter()
	{
		$this->load->view('data/vnew_dokter');
	}
	
	//fungsi untuk simpan
	function simpan(){
		$nama   = $this->input->post('nama');
		$alamat = $this->input->post('alamat');
		$kota   = $this->input->post('kota');
		$tlp    = $this->input->post('tlp');
		$fax    = $this->input->post('fax');
		$hp     = $this->input->post('hp');
		
		$dokterid = $this->mdokter->create_dokterid();
		
		$poli   = 1;
		$this->mdokter->simpan($dokterid,$nama,$alamat,$kota,$tlp,$fax,$hp,$poli);
		
		redirect('data/dokter/new_dokter');
	}
	
}